#pragma once
#include <QString>

#include "payload.h"
#include "communicationexception.h"
#include "connectionconfig.h"
#include "noncopyable.h"
#include "connectionerrorinfo.h"
#include "sessionstate.h"

namespace apollo
{
	namespace core
	{
		

		class Connection : public QObject, private NonCopyable
		{
			Q_OBJECT

		
		public:
			explicit Connection(QObject * parent = NULL) throw();

			virtual ~Connection(void) throw();

			
			virtual QString& getConnectionName() = 0;
			
			
			virtual PayloadPtr connect(PayloadPtr loginRequest) = 0;
			virtual PayloadPtr reconnect(PayloadPtr loginRequest) = 0;
			virtual void disconnect() = 0;
			virtual void write(PayloadPtr payload) = 0;
			virtual bool isReady() const = 0;
			virtual const SessionState& getState() = 0;
			
 signals:
			void dataArrived(PayloadPtr payload) ;
			void stateChanged(const SessionState &state);
			void errorHappened(const ConnectionErrorInfo &errorInfo);
		

		};
	}
}
